﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.ServiceProcess;
using System.Text;

namespace DnsCaptureService
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] 
			{ 
				new DnsCaptureService()  
			};
            try
            {
                ServiceBase.Run(ServicesToRun);
            }
            catch (Exception ex)
            {
                       StreamWriter ew = new StreamWriter(ConfigurationManager.AppSettings["ErrorLogPath"].ToString(), true, Encoding.UTF8);
                       ew.WriteLine(ex.Message + "\n\r" + ex.StackTrace);
                       ew.Flush() ;
                       ew.Close();

            }
        }
    }
}
